[xen, xencomm] xencomm trivial bug fix
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 14 Aug 2007 15:01:08 +0000 (16:01 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 14 Aug 2007 15:01:08 +0000 (16:01 +0100)
- fix return address of xencomm_copy_to_guest()
- fix xencomm_add_offset()
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
xen/common/xencomm.c

index 8b7e502869af1c3f411903cbb036c4967ce382b6..3ee5d00c2517a383bd8497573145892a01d56bdf 100644 (file)
@@ -232,7 +232,7 @@ xencomm_copy_to_guest(void *to, const void *from, unsigned int n,
 
             dest_maddr = paddr_to_maddr(dest_paddr + chunk_skip);
             if (dest_maddr == 0)
-                return -1;
+                return n - from_pos;
 
             if (xencomm_debug)
                 printk("%lx[%d] -> %lx\n", source, bytes, dest_maddr);
@@ -280,6 +280,11 @@ int xencomm_add_offset(void **handle, unsigned int bytes)
         unsigned int chunksz;
         unsigned int chunk_skip;
 
+        if (dest_paddr == XENCOMM_INVALID) {
+            i++;
+            continue;
+        }
+
         pgoffset = dest_paddr % PAGE_SIZE;
         chunksz = PAGE_SIZE - pgoffset;
 
@@ -291,6 +296,8 @@ int xencomm_add_offset(void **handle, unsigned int bytes)
             desc->address[i] += chunk_skip;
         }
         bytes -= chunk_skip;
+
+        i++;
     }
     return 0;
 }